<template>
	<view class="content">
		<u-tabbar :value="currentTab" :fixed="true" :placeholder="false" :border="false" v-if="type == 0" zIndex="9999"
			activeColor="#000000" inactiveColor="#666666">
			<u-tabbar-item @click="goSwitch(item.pagePath)" v-for="(item, index) in list" :key="item.pagePath"
				:text="item.text">
				<view slot="active-icon" class="box">
					<image :src="item.selectedIconPath" mode="aspectFit|aspectFill|widthFix" lazy-load="false" class="icon" />
				</view>
				<view slot="inactive-icon" class="box">
					<image :src="item.iconPath" mode="aspectFit|aspectFill|widthFix" lazy-load="false" class="icon" />
				</view>
			</u-tabbar-item>
		</u-tabbar>
		<u-tabbar :value="currentTab" :fixed="true" :placeholder="false" :border="false" v-else activeColor="#000000"
			zIndex="9999" inactiveColor="#666666">
			<u-tabbar-item @click="goBack(item.pagePath)" v-for="(item, index) in list1" :key="item.pagePath" :text="item.text">
				<view slot="active-icon" class="box">
					<image :src="item.selectedIconPath" mode="aspectFit|aspectFill|widthFix" lazy-load="false" class="icon" />
				</view>
				<view slot="inactive-icon" class="box">
					<image :src="item.iconPath" mode="aspectFit|aspectFill|widthFix" lazy-load="false" class="icon" />
				</view>
			</u-tabbar-item>
		</u-tabbar>
	</view>
</template>

<script>
export default {
	name: 'tabbar',
	props: ['currentTab', 'type', 'scroll'],
	data() {
		return {
			list: [
				{
					"pagePath": "/pages/pocketShop/home/index",
					"iconPath": "/static/images/home.png",
					"selectedIconPath": "/static/images/homeAct.png",
					"text": "首页"
				}, {
					"pagePath": "/pages/pocketShop/shopping/index",
					"iconPath": "/static/images/shop.png",
					"selectedIconPath": "/static/images/shopAct.png",
					"text": "购物车"
				}, {
					"pagePath": "/pages/pocketShop/mine/index",
					"iconPath": "/static/images/mine.png",
					"selectedIconPath": "/static/images/mineAct.png",
					"text": "我的"
				}
			],
			list1: [
				{
					"pagePath": "/pages/premiumBag/home/index",
					"iconPath": "/static/icon/home.png",
					"selectedIconPath": "/static/icon/home-checked.png",
					"text": "首页"
				}, 
				// {
				// 	"pagePath": "/pages/premiumBag/goods/index",
				// 	"iconPath": "/static/icon/cart.png",
				// 	"selectedIconPath": "/static/icon/cart-checked.png",
				// 	"text": "自提"
				// },
				 {
					"pagePath": "/pages/premiumBag/cart/index",
					"iconPath": "/static/icon/self.png",
					"selectedIconPath": "/static/icon/self-checked.png",
					"text": "购物车"
				}, {
					"pagePath": "/pages/premiumBag/mine/index",
					"iconPath": "/static/icon/mine.png",
					"selectedIconPath": "/static/icon/mine-checked.png",
					"text": "我的"
				}
			],


		}
	},
	methods: {
		printScroll(scroll) {
			if (this.type == 0) {
				if (scroll == 0) {
					this.list = [
						{
							"pagePath": "/pages/pocketShop/home/index",
							"iconPath": "/static/images/homeAct.png",
							"selectedIconPath": "/static/images/homeAct.png",
							"text": "首页"
						}, {
							"pagePath": "/pages/pocketShop/shopping/index",
							"iconPath": "/static/images/shop.png",
							"selectedIconPath": "/static/images/shopAct.png",
							"text": "购物车"
						}, {
							"pagePath": "/pages/pocketShop/mine/index",
							"iconPath": "/static/images/mine.png",
							"selectedIconPath": "/static/images/mineAct.png",
							"text": "我的"
						}
					]
				} else {
					this.list = [
						{
							"pagePath": "",
							"iconPath": "/static/images/scroll.png",
							"selectedIconPath": "/static/images/scroll.png",
							"text": ""
						}, {
							"pagePath": "/pages/pocketShop/shopping/index",
							"iconPath": "/static/images/shop.png",
							"selectedIconPath": "/static/images/shopAct.png",
							"text": "购物车"
						}, {
							"pagePath": "/pages/pocketShop/mine/index",
							"iconPath": "/static/images/mine.png",
							"selectedIconPath": "/static/images/mineAct.png",
							"text": "我的"
						}
					]
				}
			} else {
				if (scroll == 0) {
					this.list1 = [
						{
							"pagePath": "/pages/premiumBag/home/index",
							"iconPath": "/static/icon/home-checked.png",
							"selectedIconPath": "/static/icon/home-checked.png",
							"text": "首页"
						},
						//  {
						// 	"pagePath": "/pages/premiumBag/goods/index",
						// 	"iconPath": "/static/icon/cart.png",
						// 	"selectedIconPath": "/static/icon/cart-checked.png",
						// 	"text": "自提"
						// },
						 {
							"pagePath": "/pages/premiumBag/cart/index",
							"iconPath": "/static/icon/self.png",
							"selectedIconPath": "/static/icon/self-checked.png",
							"text": "购物车"
						}, {
							"pagePath": "/pages/premiumBag/mine/index",
							"iconPath": "/static/icon/mine.png",
							"selectedIconPath": "/static/icon/mine-checked.png",
							"text": "我的"
						}
					]
				} else {
					this.list1 = [
						{
							"pagePath": "",
							"iconPath": "/static/images/scroll.png",
							"selectedIconPath": "/static/images/scroll.png",
							"text": ""
						},
						//  {
						// 	"pagePath": "/pages/premiumBag/goods/index",
						// 	"iconPath": "/static/icon/cart.png",
						// 	"selectedIconPath": "/static/icon/cart-checked.png",
						// 	"text": "自提"
						// },
						 {
							"pagePath": "/pages/premiumBag/cart/index",
							"iconPath": "/static/icon/self.png",
							"selectedIconPath": "/static/icon/self-checked.png",
							"text": "购物车"
						}, {
							"pagePath": "/pages/premiumBag/mine/index",
							"iconPath": "/static/icon/mine.png",
							"selectedIconPath": "/static/icon/mine-checked.png",
							"text": "我的"
						}
					]
				}
			}

		},
		goSwitch(url) {
			if (url) {
				this.$goPath(3, url)
			} else {
				this.$emit('scrollTop', true)
			}
		},
		goBack(url) {
			if (url) {
				this.$goPath(2, url)
			} else {
				this.$emit('scrollTop', true)
			}
		}
	}
}
</script>

<style lang="scss">
.icon {
	width: 50rpx;
	height: 50rpx;
}
</style>
